<?php
require_once "config.php";
require_once "weixin_info.php";
    if($_SERVER['REQUEST_METHOD'] == 'POST'){
        $txt = $_POST['txt'];
        $conment_id = $_POST['conment_id'];
        $retime = time();
        if(empty($txt)){
            $result['status'] = 'n';
            $result['info'] = '评论内容不能为空';
            exit(json_encode($result));
        }
        $mem_sql = $mysql->query("select * from dyspw_member where id = ".$_SESSION['Member_info'][0]['id']);
        $Member_info = $mem_sql->fetch_all(MYSQLI_ASSOC);
        $add_messign = $mysql->query("INSERT INTO dyspw_message (recont, retime, checkinfo,uimg, uname, uid, c_id) VALUES  ('{$txt}','{$retime}','true','{$Member_info[0]['avatar']}','{$Member_info[0]['username']}',{$Member_info[0]['id']},{$conment_id})");
        if($add_messign){
            $mes_sql = $mysql->query("select * from dyspw_message where uid = {$Member_info[0]['id']} and c_id = {$conment_id} and recont = '{$txt}'");
            $messign = $mes_sql->fetch_all(MYSQLI_ASSOC);
            $result['status'] = 'y';
            $result['info'] = '评论成功';
            $result['data'] = $messign[0];
            exit(json_encode($result));
        }else{
            $result['status'] = 'n';
            $result['info'] = '评论失败，请重新提交';
            exit(json_encode($result));
        }
    }

 ?>
